// about.js

var util = require('../../../utils/util.js');
var api = require('../../../config/api.js');
var user = require('../../../utils/user.js');
var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
	userInfo: {
	    nickName: '点击登录',
		id: 0,
	    avatarUrl: 'http://yanxuan.nosdn.127.net/8945ae63d940cc42406c3f67019c5cb6.png'
	},
    load_statue: true,
    shopInfo: {
      name: 'litemall',
      address: 'https://github.com/linlinjava/litemall',
      latitude: 34.738912,
      longitude: 113.637536,
      linkPhone: '021-xxxx-xxxx',
      qqNumber: '738696120'
    },
	userAll: {
		id: 0,
		username: 'lvmingyang',
		balanceAvailable: 0.00,
		balanceFrozen: 0.00
	},
	balanceAvailable: 0.00,
  },
  
  showLocation: function (e) {
	  console.log("!23123")
    getWallet();
  },
  onShow: function() {
  
    //获取用户的登录信息
    if (app.globalData.hasLogin) {
      let userInfo = wx.getStorageSync('userInfo');
	  //console.log(userInfo)
      this.setData({
        userInfo: userInfo,
        hasLogin: true
      });
  
      let that = this;
      util.request(api.UserIndex).then(function(res) {
        if (res.errno === 0) {
          that.setData({
            order: res.data.order
          });
        }
      });
	  
	  // let that2 = this;
	  // util.request(api.UserWallet).then(function(res) {
	  //   if (res.errno === 0) {
	  //     that2.setData({
	  //      order: res.data.order,
	  // 	   userAll.balanceAvailable: res.balanceAvailable
	  //     });
	  		 
	  //   }
	  // 		//this.userAll.balanceAvailable = 100.00
	  // 		console.log(123)
	  // 		//console.log(res)
	  		
	  		
	  // });
	  //console.log(that2.userAll.balanceAvailable)
    }
	//console.log(this.userAll)
	
	
  },
  getUserWallet(){
	  // util.request(api.UserWallet).then(function(res) {
	  //   if (res.errno === 0) {
	  //     that.setData({
	  //      order: res.data.order
	  //     });
	  		 
	  //   }
	  // 		//this.userAll.balanceAvailable = 100.00
	  // 		console.log(123)
	  // 		console.log(res)
	  // 		//console.log(this.balanceAvailable)
	  		
	  		
	  // });
  }

  
  
  
  
  
})